<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title></title>
	<link rel="stylesheet" href="">
</head>
<body>
<script src="https://cdn.bootcss.com/vue/2.3.4/vue.js"></script>
<script src="vuex.js"></script>	
<div id="app">
</div>
<script>
const store = new Vuex.Store({
  state: {
    count: 1
  },
  //template : `<button @click='increment'>+</button>`,
  mutations: {
    increment (state) {
      // 变更状态
      state.count++
    }
  }
})
const Counter = {
	template : `<div>
		{{count}}
	</div>`,
	computed : {
		count(){
			return store.state.count;
		}
	}
}
store.commit('increment');
const vm = new Vue({
	el : '#app',
	store,
	components : {Counter},
	template : `<div><counter></counter></div>`,
})
</script>	
</body>
</html>